import request from '@/utils/request'

// 查询工作流任务列表
export function listMatter(query) {
  return request({
    url: '/task/matter/list',
    method: 'get',
    params: query
  })
}

// 查询工作流任务列表
export function listCountMatter(query) {
  return request({
    url: '/task/matter/listCount',
    method: 'get',
    params: query
  })
}

// 查询工作流任务详细
export function getMatter(id) {
  return request({
    url: '/task/matter/' + id,
    method: 'get'
  })
}
// 查询工作流任务详细
export function getMatterInfo(data) {
  return request({
    url: '/task/matter/getMatterInfo',


    method: 'post',
    data: data
  })
}
// 查询工作流任务详细
export function getUserTree(params) {
  return request({
    url: '/task/matter/getUserTree',
    method: 'get',
    params: params,
  })
}
// 接收任务
export function receiveTaskFlow(params) {
  return request({
    url: '/task/matter/receiveTaskFlow',
    method: 'get',
    params: { taskMatterId: params },
  })
}
// 撤销任务
export function withdrawTaskFlow(params) {
  return request({
    url: '/task/matter/withdrawTaskFlow',
    method: 'get',
    params: { taskMatterId: params },
  })
}
// 删除任务
export function deleteTaskFlow(params) {
  return request({
    url: '/task/matter/deleteTaskFlow',
    method: 'get',
    params: { taskMatterId: params },
  })
}
//导出字段列表
export function getExportFields(params) {
  return request({
    url: '/task/matter/getExportFields',
    method: 'get',
    params: { taskType: params },
  })
}

// 新增工作流任务
export function addMatter(data) {
  return request({
    url: '/task/matter',
    method: 'post',
    data: data
  })
}

// 修改工作流任务
export function updateMatter(data) {
  return request({
    url: '/task/matter',
    method: 'put',
    data: data
  })
}

// 删除工作流任务
export function delMatter(id) {
  return request({
    url: '/task/matter/' + id,
    method: 'delete'
  })
}

// 导出工作流任务
export function exportMatter(query) {
  return request({
    url: '/task/matter/export',
    method: 'post',
    data: query
  })
}

/**
 * @Desc: 获取工作流任务信息
 * @Author: daifen
 * @Date: 2020-06-09 15:29:29
 * @param {type} 
 * @return: 
 */
export function getTaskStepInfo(data) {
  return request({
    url: '/task/matter/getTaskStepInfo',
    method: 'post',
    data: data
  })
}


/**
 * @Desc: 项目审批全过程的任务流信息
 * @Author: daifen
 * @Date: 2020-06-15 14:09:32
 * @param {type} 
 * @return: 
 */
export function getMatterByProjectId(id) {
  return request({
    url: '/task/matter/getMatterByProjectId',
    params: { projectId: id },
    method: 'get',
  })
}

